import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'

const RouterChildren = [{
  path: '/',
  name: 'Workbench',
  title:'工作台',
  component: () => import(/* webpackChunkName: "workbench" */ '../views/workbench/index.vue'),
},{
  path: '/writer',
  name: 'writer',
  title:'文章管理',
  component: () => import(/* webpackChunkName: "writer" */ '../views/writer/index.vue'),
},{
  path: '/page',
  name: 'page',
  title:'页面管理',
  component: () => import(/* webpackChunkName: "page" */ '../views/page/index.vue'),
},{
  path: '/poster',
  name: 'poster',
  title:'海报管理',
  component: () => import(/* webpackChunkName: "poster" */ '../views/poster/index.vue'),
},{
  path: '/comment',
  name: 'comment',
  title:'文章管理',
  component: () => import(/* webpackChunkName: "comment" */ '../views/comment/index.vue'),
},{
  path: '/mailbox',
  name: 'mailbox',
  title:'邮件管理',
  component: () => import(/* webpackChunkName: "mailbox" */ '../views/mailbox/index.vue'),
},{
  path: '/file',
  name: 'file',
  title:'文件管理',
  component: () => import(/* webpackChunkName: "file" */ '../views/file/index.vue'),
},{
  path: '/search',
  name: 'search',
  title:'搜索记录',
  component: () => import(/* webpackChunkName: "search" */ '../views/search/index.vue'),
},{
  path: '/visit',
  name: 'visit',
  title:'访问统计',
  component: () => import(/* webpackChunkName: "visit" */ '../views/visit/index.vue'),
},{
  path: '/user',
  name: 'user',
  title:'用户管理',
  component: () => import(/* webpackChunkName: "user" */ '../views/user/index.vue'),
},{
  path: '/system',
  name: 'system',
  title:'系统设置',
  component: () => import(/* webpackChunkName: "system" */ '../views/system/index.vue'),
},]

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'Layout',
    component: () => import(/* webpackChunkName: "Layout" */ '../views/layout/index.vue'),
    children: RouterChildren
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import(/* webpackChunkName: "login" */ '../views/login/index.vue')
  },
  {
    path: '/sign',
    name: 'sign',
    component: () => import(/* webpackChunkName: "sign" */ '../views/sign/index.vue')
  },
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
